import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';
import nodejs from '@dfeidao/atom-web/msg/nodejs';
import set from '@dfeidao/atom-web/local/set';

export default async function a009(fd: IFeidaoAiBrowserComponent, no: string) {
	// todo
	//console.log('zj5a009', no);
	const res = await nodejs<Array<{ equip_type_no: string; equip_type_name: string }>>('device-type/zj-000005/s002', {});
	//console.log('zj5a009', res);
	const arr: String[] = [];
	res.forEach((v) => {
		arr.push(v.equip_type_no);
	});
	//console.log('zj5a009', arr);
	for (let i = 0; i < arr.length; i++) {
		if (no === arr[i]) {
			const n = res[i].equip_type_name
			const name = fd.data.node.querySelector<HTMLSpanElement>('[data-id="equip_type_name"]');
			name.innerHTML = n;
			console.log('aaaaa', res[i].equip_type_name)
			set(fd, 'name', n);
		}
	}

}
